#include<stdio.h>
#include<stdlib.h>
#include<memory.h>

int size = 1024;
#define N 10000
int * p[N];

int main()
{
	int k = 0;
	int j = 0;
	for(j = 0; j < 10; ++j)
	{
		//we allocate (4*size/page_size)*N pages
		for(k = 0; k < N; ++k)
		{
			p[k] = (int *)malloc(sizeof(int) * size);
			if(p[k] == NULL)
			{	
				printf("malloc error!\n");
				return 0;
			}
			int i = 0;
			for(; i < size; ++i)
				p[k][i] = i;
		}
		
		//write the allocated memory
//		for(k = 0; k < N; ++k)
//		{
//		}
		
		//free the allocated memory
		for(k = 0; k < N; ++k)
		{
			free(p[k]);
		}
	}

	return 0;
}
